package com.atguigu.gulimall.product.sync.pool;

import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

public class ThreadPoolDemo {
    public static void main(String[] args) {
        //5个窗口
//        ExecutorService threadPool1 = Executors.newFixedThreadPool(5);

        ScheduledExecutorService threadPool2 = Executors.newSingleThreadScheduledExecutor();
        try {
            for (int i = 1; i <= 10; i++) {
                threadPool2.execute(()->{
                    System.out.println(Thread.currentThread().getName()+"在办理业务");
                });

            }
        }finally {
            threadPool2.shutdown();
        }


    }
}
